import pygame
from settings import Settings
import game_function as gf
from button import Button
from scoreboard import Scoreboard

def run_game():
    pygame.init()
    pysetting = Settings()
    pygame.display.set_caption("汉诺塔游戏--by ouxianzhi")
    screen = pygame.display.set_mode((pysetting.screen_width, pysetting.screen_height))
    towers = gf.createTower(screen, pysetting)
    items = None
    play_button = Button(screen, "Start")
    # 开始游戏
    while True:
        if pysetting.newGame:
            items = gf.createItem(screen, pysetting, towers.sprites()[0], pysetting.level)
            pysetting.currentItemTower = towers.sprites()[0]
            pysetting.newGame = False
        scoreBoard = Scoreboard(pysetting, screen)
        gf.check_event(screen, pysetting, towers, play_button)
        gf.update_screen(screen, pysetting, towers, items,play_button,scoreBoard)
        

run_game()